using System;

using System.Xml;

using System.Data;
using Aulac.Global.Enums; using Aulac.Global.Data; using Aulac.Global.Common; using Aulac.Global.Xml;
using Aulac.Rsc.Bss; using Aulac.Rsc.Bss.Tags;
using System.Windows.Forms;
using System.Collections.Generic;
using Aulac.Verb.Ems;
using Aulac.Client.Global.Member;
using Aulac.Verb.Bss;

namespace Aulac.Client.Bss.InOutPut
{
	/// <summary>
	/// Summary description for DataCommon.
	/// </summary>
    class DataMngStoreHelper
	{
        internal static string GetVchNoStore(VchTypes pVchType, ref string pVchName)
        {
            try
            {
                XmlDataDocument doc = GlobalMember.AulacConnectSrv.CreateXmlDocument(AulacEmsVerb.MngStore.RecStore.GetNewVchNo, AulacEmsVerb.MngStore.Noun.MngStore);
                XmlProcess.AddValueParamItem(doc, tagVch.Common.VchTypeID, pVchType);
                //XmlProcess.AddValueParamItem(doc, tagVch.TagStoreType, pTagStoreType);
                doc = GlobalMember.AulacConnectSrv.ProcessRequest(doc);
                pVchName = XmlProcess.GetValueVchHeader(doc, tagVch.Common.VchName);
                return XmlProcess.GetValueVchHeader(doc, tagGeneral.VchNo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }


        internal static XmlDataDocument GetVchBuyItem(string mVoucherID, VchTypes mVoucherType)
        {
            XmlDataDocument xmlDoc = GlobalMember.AulacConnectSrv.CreateXmlDocument(AulacBssVerb.BuyItem.GetListDetailBuyItem, AulacBssVerb.BuyItem.Noun.BuyItem);
            XmlProcess.AddValueParamItem(xmlDoc, tagGeneral.VchOrgID, mVoucherID);
            XmlProcess.AddValueParamItem(xmlDoc, tagGeneral.VchTypeID, mVoucherType);
            return GlobalMember.AulacConnectSrv.ProcessRequest(xmlDoc);
        }

        internal static XmlDataDocument GetVchRelsStore(string pVoucherID, VchTypes pVoucherType)
        {
            XmlDataDocument xmlDoc = GlobalMember.AulacConnectSrv.CreateXmlDocument(Aulac.Verb.Bss.AulacBssVerb.RecStore.GetListVchCapAss, Aulac.Verb.Bss.AulacBssVerb.RecStore.Noun.RecvStore);
            XmlProcess.AddValueParamItem(xmlDoc, tagGeneral.VchOrgID, pVoucherID);
            XmlProcess.AddValueParamItem(xmlDoc, tagGeneral.VchTypeID, pVoucherType);
            return GlobalMember.AulacConnectSrv.ProcessRequest(xmlDoc);
        }

        internal static XmlDataDocument SaveDataToServer(XmlDataDocument xmlDoc)
        {
            return GlobalMember.AulacConnectSrv.ProcessRequest(xmlDoc);
        }

    }
}
